#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <unistd.h>
#include <string.h>
#include <sys/shm.h>


int main(int argc, const char *argv[])
{
	key_t key1=ftok("./2.txt",'b');
	int shmid=shmget(key1,4096,IPC_CREAT|0664);
	char *buf=shmat(shmid,NULL,0);
	memset(buf,0,4096);

	pid_t pid=fork();

	if(pid>0)
	{
		while(1)
		{
			scanf("%s",buf);
		}
	}
	else if(pid==0)
	{
		while(1)
		{
			if(strlen(buf)!=0)
			{
				printf("get :%s\n",buf);
				memset(buf,0,4096);
			}
		}
	}

	return 0;
}
